Skip to content

ci: auto-publish @zalify/sdk to npm - #1

Open
renyuanz wants to merge 1 commit into
mainfrom
ci/auto-publish
Open

renyuanz wants to merge 1 commit into
mainfrom
ci/auto-publish

Conversation

@renyuanz

Copy link
Copy Markdown
Contributor

Adds a publish job to ci.yml, modelled on zalify-cli's publish.yml.

  • On a push to main, after the Node 18/20/22 tests pass, it compares package.json's version with npm. If the version is new, it runs npm publish --access public --provenance and tags the commit v<version>. To release, bump the version.
  • Auth: the first publish uses the NPM_TOKEN repo secret, because npm can only attach a trusted publisher to a package that already exists. After 0.3.0 is out, add a trusted publisher on npmjs.com (repository zalify/zalify-node, workflow ci.yml) and delete the secret. npm tries OIDC first and falls back to the token, so both work in the meantime.
  • Also runs test/contacts.test.ts in CI. The explicit test list had missed it; it passes.

Locally: 12/12 tests pass. npm pack --dry-run produces @zalify/[email protected] with 7 files and 10.8 kB.

Merge only after NPM_TOKEN is added. Without it, the publish job on main goes red.

🤖 Generated with Claude Code

Push to main publishes when package.json's version isn't on npm yet, then
tags v<version>. First publish uses the NPM_TOKEN secret; switch to npm
Trusted Publishing afterwards. Also runs contacts.test.ts in CI, which the
explicit test list had missed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant